Full source code website bán hàng thương mại điện tử gần giống shopee
468.801 lượt xem;
1 <script language="Javascript1.2"><!-- // load htmlarea
2 _editor_url = "htmlarea/"; // URL to htmlarea files
3 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
4 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
5 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
6 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
7 if (win_ie_ver >= 5.5) {
8 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
9 document.write(' language="Javascript1.2"></scr' + 'ipt>');
10 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
11 // --></script>
12
13 <?
14 $path = "../edoc/files/";
15 $pathdb = "edoc/files";
16 if (isset($_POST['butSaveLoai'])) {
17 $name=$_POST['txtName'];
18 $desc=$_POST['txtShortDesc'];
19 $status=($_POST['chkShow']!=''?1:0);
20 $categories_id=$_POST['ddCat'];
21
22 $err="";
23 if ($name=="") $err .= "Xin nhập tên bảng báo giá <br>";
24 $err.=CheckUpload($_FILES["txtFile"],".doc;.xls;.zip;.rar;.pdf;.wma;.wmv;.mp3;.mp4;.asf;.avi;.mpg;.mpeg;.mid;.enc;.cpt;",100*1024*1024,$_POST['id']==''?1:0);
25
26 if ($err=='')
27 {
28 if (!empty($_POST['id'])) {
29 $oldid = $_POST['id'];
30 $sql = "update doc_files set doc_files_name='".$name."',doc_files_description='".$desc."',doc_files_status='".$status."',doc_files_categoriesid='".$categories_id."' where doc_files_id='".$oldid."'";
31 }else {
32 $sql = "insert into doc_files (doc_files_name,doc_files_description,doc_files_status,doc_files_dateadded,doc_files_categoriesid) values ('".$name."','".$desc."','".$status."',SYSDATE(),'".$categories_id."')";
33 }
34
35 if (mysql_query($sql,$con)) {
36 if(empty($_POST['id'])) $oldid = mysql_insert_id();
37
38 $sqlUpdateField = "";
39
40 $fn=$_FILES['txtFile']['name'];
41
42 $extsmall=GetFileExtention($_FILES['txtFile']['name']);
43 if (MakeUpload($_FILES['txtFile'],"$path/$fn"))
44 {
45 @chmod("$path/doc_file$oldid$extsmall", 0777);
46 $sqlUpdateField = " doc_files_file='$pathdb/$fn' ";
47 }
48
49 if($sqlUpdateField!='')
50 {
51 $sqlUpdate = "update doc_files set $sqlUpdateField where doc_files_id='".$oldid."'";
52 mysql_query($sqlUpdate,$con);
53 }
54 }
55
56 else {
57 $err = "Không thể cập nhật";
58 }
59 }
60
61 if ($err=='') echo '<script>window.location="index.php?act=edoc&page='.$_REQUEST['page'].'&code=1"</script>';
62 else echo "<p align=center class='err'>".$err."</p>";
63 }
64 ?>
65
66 <?
67 if (isset($_GET['id'])) {
68 $oldid=$_GET['id'];
69 $page = $_GET['page'];
70 $sql = "select * from doc_files where doc_files_id='".$oldid."' limit 1";
71 if ($result = mysql_query($sql,$con)) {
72 $row=mysql_fetch_array($result);
73 $name=$row['doc_files_name'];
74 $desc=$row['doc_files_description'];
75 $image=$row['doc_files_file'];
76 $status=$row['doc_files_status'];
77 $categories_id = $row['doc_files_categoriesid'];
78 }
79 }
80 ?>
81
82 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php">
83 <input type="hidden" name="act" value="edoc_m">
84 <input type="hidden" name="page" value="<? echo $_REQUEST['page']; ?>">
85 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
86 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
87 <tr>
88 <td width="45%" class="title" align="center" height="20">Thêm mới / Cập nhật
89 : Thư viện</td>
90 </tr>
91 <tr>
92 <td width="45%">
93 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
94 <tr>
95 <td width="15%" class="smallfont">
96 <p align="right">Tên </td>
97 <td width="1%" class="smallfont" align="center">
98 <font color="#FF0000">*</font></td>
99 <td width="83%" class="smallfont">
100 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="45"></td>
101 </tr>
102 <tr>
103 <td width="15%" class="smallfont">
104 <p align="right">File</td>
105 <td width="1%" class="smallfont" align="center">
106 <font color="#FF0000">*</font></td>
107 <td width="83%" class="smallfont">
108 <INPUT TYPE="file" NAME="txtFile" CLASS=textbox size="34"></td>
109 </tr>
110 <tr>
111 <td width="15%" class="smallfont" align="right">
112 Thuộc danh mục</td>
113 <td width="1%" class="smallfont" align="center">
114 </td>
115 <td width="83%" class="smallfont">
116 <select size="1" name="ddCat">
117
118 <?
119 $cats=GetListDoc(1);
120 foreach ($cats as $cat)
121 {
122 if ($cat[0]==$categories_id)
123 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
124 else
125 echo "<option value=".$cat[0].">".$cat[1]."</option>";
126 }
127 ?>
128 </select></td>
129 </tr>
130 <tr>
131 <td width="15%" class="smallfont" align="right">
132 Không cho hiện</td>
133 <td width="1%" class="smallfont" align="center">
134 </td>
135 <td width="83%" class="smallfont">
136 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
137 </tr>
138 <tr>
139 <td width="15%" class="smallfont">
140 <p align="right">
141 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập Nhật" CLASS=button> </td>
142 <td width="1%" class="smallfont" align="center">
143 </td>
144 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
145 </tr>
146 </table>
147 </td>
148 </tr>
149 </table>
150 </form>
2 _editor_url = "htmlarea/"; // URL to htmlarea files
3 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
4 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
5 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
6 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
7 if (win_ie_ver >= 5.5) {
8 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
9 document.write(' language="Javascript1.2"></scr' + 'ipt>');
10 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
11 // --></script>
12
13 <?
14 $path = "../edoc/files/";
15 $pathdb = "edoc/files";
16 if (isset($_POST['butSaveLoai'])) {
17 $name=$_POST['txtName'];
18 $desc=$_POST['txtShortDesc'];
19 $status=($_POST['chkShow']!=''?1:0);
20 $categories_id=$_POST['ddCat'];
21
22 $err="";
23 if ($name=="") $err .= "Xin nhập tên bảng báo giá <br>";
24 $err.=CheckUpload($_FILES["txtFile"],".doc;.xls;.zip;.rar;.pdf;.wma;.wmv;.mp3;.mp4;.asf;.avi;.mpg;.mpeg;.mid;.enc;.cpt;",100*1024*1024,$_POST['id']==''?1:0);
25
26 if ($err=='')
27 {
28 if (!empty($_POST['id'])) {
29 $oldid = $_POST['id'];
30 $sql = "update doc_files set doc_files_name='".$name."',doc_files_description='".$desc."',doc_files_status='".$status."',doc_files_categoriesid='".$categories_id."' where doc_files_id='".$oldid."'";
31 }else {
32 $sql = "insert into doc_files (doc_files_name,doc_files_description,doc_files_status,doc_files_dateadded,doc_files_categoriesid) values ('".$name."','".$desc."','".$status."',SYSDATE(),'".$categories_id."')";
33 }
34
35 if (mysql_query($sql,$con)) {
36 if(empty($_POST['id'])) $oldid = mysql_insert_id();
37
38 $sqlUpdateField = "";
39
40 $fn=$_FILES['txtFile']['name'];
41
42 $extsmall=GetFileExtention($_FILES['txtFile']['name']);
43 if (MakeUpload($_FILES['txtFile'],"$path/$fn"))
44 {
45 @chmod("$path/doc_file$oldid$extsmall", 0777);
46 $sqlUpdateField = " doc_files_file='$pathdb/$fn' ";
47 }
48
49 if($sqlUpdateField!='')
50 {
51 $sqlUpdate = "update doc_files set $sqlUpdateField where doc_files_id='".$oldid."'";
52 mysql_query($sqlUpdate,$con);
53 }
54 }
55
56 else {
57 $err = "Không thể cập nhật";
58 }
59 }
60
61 if ($err=='') echo '<script>window.location="index.php?act=edoc&page='.$_REQUEST['page'].'&code=1"</script>';
62 else echo "<p align=center class='err'>".$err."</p>";
63 }
64 ?>
65
66 <?
67 if (isset($_GET['id'])) {
68 $oldid=$_GET['id'];
69 $page = $_GET['page'];
70 $sql = "select * from doc_files where doc_files_id='".$oldid."' limit 1";
71 if ($result = mysql_query($sql,$con)) {
72 $row=mysql_fetch_array($result);
73 $name=$row['doc_files_name'];
74 $desc=$row['doc_files_description'];
75 $image=$row['doc_files_file'];
76 $status=$row['doc_files_status'];
77 $categories_id = $row['doc_files_categoriesid'];
78 }
79 }
80 ?>
81
82 <form method="post" name="FormLoaiSP" enctype="multipart/form-data" action="index.php">
83 <input type="hidden" name="act" value="edoc_m">
84 <input type="hidden" name="page" value="<? echo $_REQUEST['page']; ?>">
85 <input type="hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
86 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
87 <tr>
88 <td width="45%" class="title" align="center" height="20">Thêm mới / Cập nhật
89 : Thư viện</td>
90 </tr>
91 <tr>
92 <td width="45%">
93 <table border="0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
94 <tr>
95 <td width="15%" class="smallfont">
96 <p align="right">Tên </td>
97 <td width="1%" class="smallfont" align="center">
98 <font color="#FF0000">*</font></td>
99 <td width="83%" class="smallfont">
100 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="45"></td>
101 </tr>
102 <tr>
103 <td width="15%" class="smallfont">
104 <p align="right">File</td>
105 <td width="1%" class="smallfont" align="center">
106 <font color="#FF0000">*</font></td>
107 <td width="83%" class="smallfont">
108 <INPUT TYPE="file" NAME="txtFile" CLASS=textbox size="34"></td>
109 </tr>
110 <tr>
111 <td width="15%" class="smallfont" align="right">
112 Thuộc danh mục</td>
113 <td width="1%" class="smallfont" align="center">
114 </td>
115 <td width="83%" class="smallfont">
116 <select size="1" name="ddCat">
117
118 <?
119 $cats=GetListDoc(1);
120 foreach ($cats as $cat)
121 {
122 if ($cat[0]==$categories_id)
123 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
124 else
125 echo "<option value=".$cat[0].">".$cat[1]."</option>";
126 }
127 ?>
128 </select></td>
129 </tr>
130 <tr>
131 <td width="15%" class="smallfont" align="right">
132 Không cho hiện</td>
133 <td width="1%" class="smallfont" align="center">
134 </td>
135 <td width="83%" class="smallfont">
136 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
137 </tr>
138 <tr>
139 <td width="15%" class="smallfont">
140 <p align="right">
141 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập Nhật" CLASS=button> </td>
142 <td width="1%" class="smallfont" align="center">
143 </td>
144 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
145 </tr>
146 </table>
147 </td>
148 </tr>
149 </table>
150 </form>